import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Axios from "axios"
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.config.productionTip = false;

Vue.use(ElementUI)

Vue.prototype.$axios = Axios;

// 使每次请求都会带一个 /api 前缀
Axios.defaults.baseURL = '/api';

Vue.directive('permissions', {
  inserted: function (el,binding) {
      if (!store.state.userPermissions.includes(binding.value)) {
          el.parentNode.removeChild(el)
      }
  }
})

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');
